{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "品名                         规格型号       \n",
       " LMZ2-0.66/G-0.5 127*38    2000/5A        30.0\n",
       "                           2500/5A        21.0\n",
       " LMZ2-0.66/G-0.5 42*15     200/5A          3.0\n",
       "                           400/5A         12.0\n",
       " LMZ2-0.66/G-0.5 52*18     500/5A          3.0\n",
       "                                          ... \n",
       "LZZBJ9-10  10P15/0.5/0.2S  400/5A          6.0\n",
       "                           500/5A          3.0\n",
       "                           600/5A         18.0\n",
       "LZZBJ9-20  0.2S            20/5A           2.0\n",
       "熔断器                        XRNP1-12/2A   -15.0\n",
       "Name: 订单数量, Length: 472, dtype: float64"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "data=pd.read_excel(\"2020年1-12月份销售明细.xlsx\") \n",
    "Groupsum1 =data['订单数量'].astype(float).groupby([data['品名'],data['规格型号']]).sum() \n",
    "Groupsum1.head(9999)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "要货单位\n",
       "一仁电力设备有限公司                   7000.00\n",
       "七星电气股份有限公司                 119638.00\n",
       "七星电气股份有限公司  （陈碧钦）           13510.00\n",
       "三明亿源电力工程建设有限公司沙县电气设备分公司     59214.26\n",
       "三明市鑫源电力工程有限公司                4900.00\n",
       "                             ...    \n",
       "默赜电气                          480.00\n",
       "龙岩亿力电力工程有限公司龙岩经开区分公司         3457.80\n",
       "龙岩市天隆电气有限公司                  6600.00\n",
       "龙岩星海                         4200.00\n",
       "龙岩翔辉                         2670.00\n",
       "Name: 不含税金额, Length: 217, dtype: float64"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Groupsum2 =data['不含税金额'].astype(float).groupby(data['要货单位']).sum()\n",
    "Groupsum2.head(9999)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# -*- coding: utf-8 -*-\n",
    "\"\"\"\n",
    "Created on Thu Dec 24 12:33:26 2020\n",
    "\n",
    "@author: MICHEL\n",
    "\"\"\"\n",
    "\n",
    "import pandas as pd;\n",
    "import numpy as np;\n",
    "detail=pd.read_excel(\"2020年1-12月份销售明细.xlsx\")\n",
    "print(detail.head())\n",
    "print(detail.index)\n",
    "print(detail.values)\n",
    "print(\"总共有多少订单\",len(detail))\n",
    "#前三百个客户\n",
    "idaccount=detail[['业务日期','单据号码','客户名称','总金额']][:300]\n",
    "print(idaccount)\n",
    "detailGroup=idaccount.groupby(by='总金额')\n",
    "print(\"金额排序结果：\")\n",
    "print(detailGroup.max())\n",
    "detaildata2=pd.pivot_table(detail[['客户名称','总金额','审批日期']],index='客户名称',aggfunc=np.sum)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
